<!-- HTML header for doxygen 1.8.10-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="generator" content="Doxygen 1.8.10" />
    <title>ZRDDS: DeadLineQos_Subscription.java</title>
    <link href="tabs.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="dynsections.js"></script>
    <link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
    <link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
    <link href="doxygen.css" rel="stylesheet" type="text/css" />
    <link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
    <link href="static/css/bootstrap.css" rel="stylesheet" />
    <!-- <link href="static/css/sticky-footer-navbar.css" rel="stylesheet">
    <script type="text/javascript" src="static/js/bootstrap.js"></script> -->
    <script type="text/javascript" src="static/js/doxy-boot.js"></script>
</head>
<body>
    <div id="top">
        <!-- do not remove this div, it is closed by doxygen! -->
        <!-- end header part --><!-- 制作者 Doxygen 1.8.10 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li><a href="pages.html"><span>相关页面</span></a></li>
      <li><a href="namespaces.html"><span>包</span></a></li>
      <li><a href="annotated.html"><span>类</span></a></li>
      <li><a href="examples.html"><span>示例</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('_dead_line_qos__subscription_8java-example.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">DeadLineQos_Subscription.java</div>  </div>
</div><!--header-->
<div class="contents">
<p>该程序展示了典型的使用 DeadlineQos的数据接收端配置。</p>
<div class="fragment"><div class="line"><span class="keyword">package </span>DeadlineQos;</div>
<div class="line"></div>
<div class="line"><span class="keyword">import</span> java.nio.ByteOrder;</div>
<div class="line"></div>
<div class="line"><span class="keyword">import</span> idl.ShapeTypeDataReader;</div>
<div class="line"><span class="keyword">import</span> idl.ShapeTypeSeq;</div>
<div class="line"><span class="keyword">import</span> idl.ShapeTypeTypeSupport;</div>
<div class="line"></div>
<div class="line"><span class="keyword">import</span> <a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1zrdds.html">zrdds</a>.<a class="code" href="namespacecom_1_1zrdds_1_1domain.html">domain</a>.<a class="code" href="interfacecom_1_1zrdds_1_1domain_1_1_domain_participant.html">DomainParticipant</a>;</div>
<div class="line"><span class="keyword">import</span> <a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1zrdds.html">zrdds</a>.<a class="code" href="namespacecom_1_1zrdds_1_1domain.html">domain</a>.<a class="code" href="classcom_1_1zrdds_1_1domain_1_1_domain_participant_factory.html">DomainParticipantFactory</a>;</div>
<div class="line"><span class="keyword">import</span> <a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1zrdds.html">zrdds</a>.<a class="code" href="namespacecom_1_1zrdds_1_1infrastructure.html">infrastructure</a>.<a class="code" href="classcom_1_1zrdds_1_1infrastructure_1_1_instance_state_kind.html">InstanceStateKind</a>;</div>
<div class="line"><span class="keyword">import</span> <a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1zrdds.html">zrdds</a>.<a class="code" href="namespacecom_1_1zrdds_1_1infrastructure.html">infrastructure</a>.<a class="code" href="classcom_1_1zrdds_1_1infrastructure_1_1_liveliness_changed_status.html">LivelinessChangedStatus</a>;</div>
<div class="line"><span class="keyword">import</span> <a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1zrdds.html">zrdds</a>.<a class="code" href="namespacecom_1_1zrdds_1_1infrastructure.html">infrastructure</a>.<a class="code" href="classcom_1_1zrdds_1_1infrastructure_1_1_requested_deadline_missed_status.html">RequestedDeadlineMissedStatus</a>;</div>
<div class="line"><span class="keyword">import</span> <a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1zrdds.html">zrdds</a>.<a class="code" href="namespacecom_1_1zrdds_1_1infrastructure.html">infrastructure</a>.<a class="code" href="classcom_1_1zrdds_1_1infrastructure_1_1_requested_incompatible_qos_status.html">RequestedIncompatibleQosStatus</a>;</div>
<div class="line"><span class="keyword">import</span> <a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1zrdds.html">zrdds</a>.<a class="code" href="namespacecom_1_1zrdds_1_1infrastructure.html">infrastructure</a>.<a class="code" href="classcom_1_1zrdds_1_1infrastructure_1_1_return_code__t.html">ReturnCode_t</a>;</div>
<div class="line"><span class="keyword">import</span> <a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1zrdds.html">zrdds</a>.<a class="code" href="namespacecom_1_1zrdds_1_1infrastructure.html">infrastructure</a>.<a class="code" href="classcom_1_1zrdds_1_1infrastructure_1_1_sample_info.html">SampleInfo</a>;</div>
<div class="line"><span class="keyword">import</span> <a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1zrdds.html">zrdds</a>.<a class="code" href="namespacecom_1_1zrdds_1_1infrastructure.html">infrastructure</a>.<a class="code" href="classcom_1_1zrdds_1_1infrastructure_1_1_sample_info_seq.html">SampleInfoSeq</a>;</div>
<div class="line"><span class="keyword">import</span> <a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1zrdds.html">zrdds</a>.<a class="code" href="namespacecom_1_1zrdds_1_1infrastructure.html">infrastructure</a>.<a class="code" href="classcom_1_1zrdds_1_1infrastructure_1_1_sample_lost_status.html">SampleLostStatus</a>;</div>
<div class="line"><span class="keyword">import</span> <a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1zrdds.html">zrdds</a>.<a class="code" href="namespacecom_1_1zrdds_1_1infrastructure.html">infrastructure</a>.<a class="code" href="classcom_1_1zrdds_1_1infrastructure_1_1_sample_rejected_status.html">SampleRejectedStatus</a>;</div>
<div class="line"><span class="keyword">import</span> <a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1zrdds.html">zrdds</a>.<a class="code" href="namespacecom_1_1zrdds_1_1infrastructure.html">infrastructure</a>.<a class="code" href="classcom_1_1zrdds_1_1infrastructure_1_1_sample_state_kind.html">SampleStateKind</a>;</div>
<div class="line"><span class="keyword">import</span> <a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1zrdds.html">zrdds</a>.<a class="code" href="namespacecom_1_1zrdds_1_1infrastructure.html">infrastructure</a>.<a class="code" href="classcom_1_1zrdds_1_1infrastructure_1_1_status_kind.html">StatusKind</a>;</div>
<div class="line"><span class="keyword">import</span> <a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1zrdds.html">zrdds</a>.<a class="code" href="namespacecom_1_1zrdds_1_1infrastructure.html">infrastructure</a>.<a class="code" href="classcom_1_1zrdds_1_1infrastructure_1_1_subscription_matched_status.html">SubscriptionMatchedStatus</a>;</div>
<div class="line"><span class="keyword">import</span> <a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1zrdds.html">zrdds</a>.<a class="code" href="namespacecom_1_1zrdds_1_1infrastructure.html">infrastructure</a>.<a class="code" href="classcom_1_1zrdds_1_1infrastructure_1_1_view_state_kind.html">ViewStateKind</a>;</div>
<div class="line"><span class="keyword">import</span> <a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1zrdds.html">zrdds</a>.<a class="code" href="namespacecom_1_1zrdds_1_1subscription.html">subscription</a>.<a class="code" href="interfacecom_1_1zrdds_1_1subscription_1_1_data_reader.html">DataReader</a>;</div>
<div class="line"><span class="keyword">import</span> <a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1zrdds.html">zrdds</a>.<a class="code" href="namespacecom_1_1zrdds_1_1subscription.html">subscription</a>.<a class="code" href="interfacecom_1_1zrdds_1_1subscription_1_1_data_reader_listener.html">DataReaderListener</a>;</div>
<div class="line"><span class="keyword">import</span> <a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1zrdds.html">zrdds</a>.<a class="code" href="namespacecom_1_1zrdds_1_1subscription.html">subscription</a>.<a class="code" href="classcom_1_1zrdds_1_1subscription_1_1_data_reader_qos.html">DataReaderQos</a>;</div>
<div class="line"><span class="keyword">import</span> <a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1zrdds.html">zrdds</a>.<a class="code" href="namespacecom_1_1zrdds_1_1subscription.html">subscription</a>.<a class="code" href="interfacecom_1_1zrdds_1_1subscription_1_1_subscriber.html">Subscriber</a>;</div>
<div class="line"><span class="keyword">import</span> <a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1zrdds.html">zrdds</a>.<a class="code" href="namespacecom_1_1zrdds_1_1topic.html">topic</a>.<a class="code" href="interfacecom_1_1zrdds_1_1topic_1_1_topic.html">Topic</a>;</div>
<div class="line"></div>
<div class="line"><span class="keyword">public</span> <span class="keyword">class </span>DeadlineQos_Subscription {</div>
<div class="line">    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">void</span> main(String[] args) {</div>
<div class="line">        loadLibrary();</div>
<div class="line">        ReturnCode_t rtn;</div>
<div class="line"></div>
<div class="line">        <span class="comment">// 域号</span></div>
<div class="line">        <span class="keywordtype">int</span> domian_id = 80;</div>
<div class="line">        <span class="comment">// 创建域参与者</span></div>
<div class="line">        DomainParticipant dp = DomainParticipantFactory.get_instance().create_participant(</div>
<div class="line">                domian_id, DomainParticipantFactory.PARTICIPANT_QOS_DEFAULT, null,</div>
<div class="line">                StatusKind.STATUS_MASK_NONE);</div>
<div class="line">        <span class="keywordflow">if</span> (dp == null) {</div>
<div class="line">            System.out.println(<span class="stringliteral">&quot;create dp failed&quot;</span>);</div>
<div class="line">            <span class="keywordflow">return</span>;</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        <span class="comment">// 注册数据类型</span></div>
<div class="line">        ShapeTypeTypeSupport ShapeType = (ShapeTypeTypeSupport) ShapeTypeTypeSupport.get_instance();</div>
<div class="line">        rtn = ShapeType.register_type(dp, null);</div>
<div class="line">        <span class="keywordflow">if</span> (rtn != ReturnCode_t.RETCODE_OK) {</div>
<div class="line">            System.out.println(<span class="stringliteral">&quot;register type failed&quot;</span>);</div>
<div class="line">            <span class="keywordflow">return</span>;</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        <span class="comment">// 创建主题</span></div>
<div class="line">        Topic tp = dp.create_topic(<span class="stringliteral">&quot;DEADLINEQOSPOLICY&quot;</span>, ShapeType.get_type_name(),</div>
<div class="line">                DomainParticipant.TOPIC_QOS_DEFAULT, null, StatusKind.STATUS_MASK_NONE);</div>
<div class="line">        <span class="keywordflow">if</span> (tp == null) {</div>
<div class="line">            System.out.println(<span class="stringliteral">&quot;create tp failed&quot;</span>);</div>
<div class="line">            <span class="keywordflow">return</span>;</div>
<div class="line">        }</div>
<div class="line">        <span class="comment">// 创建订阅者</span></div>
<div class="line">        Subscriber sub = dp.create_subscriber(DomainParticipant.SUBSCRIBER_QOS_DEFAULT, null,</div>
<div class="line">                StatusKind.STATUS_MASK_NONE);</div>
<div class="line">        <span class="keywordflow">if</span> (sub == null) {</div>
<div class="line">            System.out.println(<span class="stringliteral">&quot;create sub failed&quot;</span>);</div>
<div class="line">            <span class="keywordflow">return</span>;</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        <span class="comment">// 创建监听器</span></div>
<div class="line">        DeadlineDataReaderListener tlistener = <span class="keyword">new</span> DeadlineDataReaderListener();</div>
<div class="line"></div>
<div class="line">        <span class="comment">// 设置dataReaderQos</span></div>
<div class="line">        DataReaderQos drQos = <span class="keyword">new</span> DataReaderQos();</div>
<div class="line">        rtn = sub.get_default_datareader_qos(drQos);</div>
<div class="line">        drQos.deadline.period.sec = 3;</div>
<div class="line">        drQos.deadline.period.nanosec = 0;</div>
<div class="line"></div>
<div class="line">        <span class="comment">// 创建数据读者</span></div>
<div class="line">        DataReader dr = sub.create_datareader(tp, drQos, tlistener,</div>
<div class="line">                StatusKind.DATA_AVAILABLE_STATUS | StatusKind.REQUESTED_DEADLINE_MISSED_STATUS);</div>
<div class="line">        <span class="keywordflow">if</span> (dr == null) {</div>
<div class="line">            System.out.println(<span class="stringliteral">&quot;create dr failed&quot;</span>);</div>
<div class="line">            <span class="keywordflow">return</span>;</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        <span class="comment">// 阻塞主线程，通过Listener监听数据到达</span></div>
<div class="line">        <span class="keywordtype">boolean</span> bo = <span class="keyword">true</span>;</div>
<div class="line">        <span class="keywordflow">while</span> (bo) {</div>
<div class="line">            tSleep(5000);</div>
<div class="line">            System.out.println(<span class="stringliteral">&quot;wait for receive data&quot;</span>);</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        <span class="comment">// 释放DDS资源</span></div>
<div class="line">        rtn = dp.delete_contained_entities();</div>
<div class="line">        <span class="keywordflow">if</span> (rtn != ReturnCode_t.RETCODE_OK) {</div>
<div class="line">            System.out.println(<span class="stringliteral">&quot;dp delete contained entities failed&quot;</span>);</div>
<div class="line">            <span class="keywordflow">return</span>;</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        rtn = DomainParticipantFactory.get_instance().delete_participant(dp);</div>
<div class="line">        <span class="keywordflow">if</span> (rtn != ReturnCode_t.RETCODE_OK) {</div>
<div class="line">            System.out.println(<span class="stringliteral">&quot;dpf delete dp failed&quot;</span>);</div>
<div class="line">            <span class="keywordflow">return</span>;</div>
<div class="line">        }</div>
<div class="line">        DomainParticipantFactory.finalize_instance();</div>
<div class="line">    }</div>
<div class="line"></div>
<div class="line">    <span class="comment">// 等待接口</span></div>
<div class="line">    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">void</span> tSleep(<span class="keywordtype">int</span> ti) {</div>
<div class="line">        <span class="keywordflow">try</span> {</div>
<div class="line">            Thread.sleep(ti);</div>
<div class="line">        } <span class="keywordflow">catch</span> (InterruptedException e) {</div>
<div class="line">            e.printStackTrace();</div>
<div class="line">        }</div>
<div class="line">    }</div>
<div class="line"></div>
<div class="line">    <span class="comment">// 已加载库标识</span></div>
<div class="line">    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keywordtype">boolean</span> hasLoad = <span class="keyword">false</span>;</div>
<div class="line"></div>
<div class="line">    <span class="comment">// 加载DDS库</span></div>
<div class="line">    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">void</span> loadLibrary() {</div>
<div class="line">        <span class="keywordflow">if</span> (!hasLoad) {</div>
<div class="line">            System.loadLibrary(<span class="stringliteral">&quot;ZRDDS_JAVA&quot;</span>);</div>
<div class="line">            hasLoad = <span class="keyword">true</span>;</div>
<div class="line">        }</div>
<div class="line">    }</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="keyword">class </span>DeadlineDataReaderListener <span class="keyword">implements</span> DataReaderListener {</div>
<div class="line"></div>
<div class="line">    @Override</div>
<div class="line">    <span class="keyword">public</span> <span class="keywordtype">void</span> on_data_available(DataReader reader) {</div>
<div class="line">        ShapeTypeDataReader dr = (ShapeTypeDataReader) (reader);</div>
<div class="line">        ShapeTypeSeq dataSeq = <span class="keyword">new</span> ShapeTypeSeq();</div>
<div class="line">        SampleInfoSeq infoSeq = <span class="keyword">new</span> SampleInfoSeq();</div>
<div class="line">        ReturnCode_t rtn;</div>
<div class="line"></div>
<div class="line">        <span class="comment">// 取出接收数据</span></div>
<div class="line">        rtn = dr.take(dataSeq, infoSeq, -1, SampleStateKind.ANY_SAMPLE_STATE,</div>
<div class="line">                ViewStateKind.ANY_VIEW_STATE, InstanceStateKind.ANY_INSTANCE_STATE);</div>
<div class="line">        <span class="keywordflow">if</span> (rtn != ReturnCode_t.RETCODE_OK) {</div>
<div class="line">            System.out.println(<span class="stringliteral">&quot;take data failed&quot;</span>);</div>
<div class="line">            <span class="keywordflow">return</span>;</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        <span class="comment">// 遍历读取接收数据</span></div>
<div class="line">        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; infoSeq.length(); ++i) {</div>
<div class="line">            <span class="comment">// 在使用数据之前，应检查数据的有效性</span></div>
<div class="line">            <span class="keywordflow">if</span> (!infoSeq.get_at(i).valid_data) {</div>
<div class="line">                <span class="keywordflow">continue</span>;</div>
<div class="line">            }</div>
<div class="line">            <span class="comment">// 打印接收数据</span></div>
<div class="line">            ShapeTypeTypeSupport shapeType = (ShapeTypeTypeSupport) ShapeTypeTypeSupport.get_instance();</div>
<div class="line">            shapeType.print_sample(dataSeq.get_at(i));</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        <span class="comment">// 返还数据空间</span></div>
<div class="line">        rtn = dr.return_loan(dataSeq, infoSeq);</div>
<div class="line">        <span class="keywordflow">if</span> (rtn != ReturnCode_t.RETCODE_OK) {</div>
<div class="line">            System.out.println(<span class="stringliteral">&quot;return loan failed&quot;</span>);</div>
<div class="line">            <span class="keywordflow">return</span>;</div>
<div class="line">        }</div>
<div class="line">    }</div>
<div class="line"></div>
<div class="line">    @Override</div>
<div class="line">    <span class="keyword">public</span> <span class="keywordtype">void</span> on_liveliness_changed(DataReader arg0, LivelinessChangedStatus arg1) {</div>
<div class="line">        <span class="comment">// TODO 自动生成的方法存根</span></div>
<div class="line">    }</div>
<div class="line"></div>
<div class="line">    @Override</div>
<div class="line">    <span class="keyword">public</span> <span class="keywordtype">void</span> on_requested_deadline_missed(DataReader reader, RequestedDeadlineMissedStatus status) {</div>
<div class="line">        <span class="keywordtype">int</span>[] arr = toIntArray(status.last_instance_handle.get_valuesI(), 16);</div>
<div class="line">        System.out.println(<span class="stringliteral">&quot;requested deadline missed&quot;</span>);</div>
<div class="line">        <span class="comment">// 可以通过RequestedDeadlineMissedStatus获取更多详细信息</span></div>
<div class="line">        System.out.println(<span class="stringliteral">&quot;RequestedDeadlineMissedStatus total_count:&quot;</span> + status.total_count);</div>
<div class="line">        System.out.println(<span class="stringliteral">&quot;RequestedDeadlineMissedStatus total_count_change:&quot;</span></div>
<div class="line">                + status.total_count_change);</div>
<div class="line">        System.out.println(<span class="stringliteral">&quot;DataReader_id = 0x&quot;</span> + String.format(<span class="stringliteral">&quot;%08X&quot;</span>, arr[0])</div>
<div class="line">                + String.format(<span class="stringliteral">&quot;%08X&quot;</span>, arr[1]) + String.format(<span class="stringliteral">&quot;%08X&quot;</span>, arr[2])</div>
<div class="line">                + String.format(<span class="stringliteral">&quot;%08X&quot;</span>, arr[3]) + <span class="stringliteral">&quot;\n&quot;</span>);</div>
<div class="line">    }</div>
<div class="line"></div>
<div class="line">    @Override</div>
<div class="line">    <span class="keyword">public</span> <span class="keywordtype">void</span> on_requested_incompatible_qos(DataReader arg0, RequestedIncompatibleQosStatus arg1) {</div>
<div class="line">        <span class="comment">// TODO 自动生成的方法存根</span></div>
<div class="line"></div>
<div class="line">    }</div>
<div class="line"></div>
<div class="line">    @Override</div>
<div class="line">    <span class="keyword">public</span> <span class="keywordtype">void</span> on_sample_lost(DataReader arg0, SampleLostStatus arg1) {</div>
<div class="line">        <span class="comment">// TODO 自动生成的方法存根</span></div>
<div class="line"></div>
<div class="line">    }</div>
<div class="line"></div>
<div class="line">    @Override</div>
<div class="line">    <span class="keyword">public</span> <span class="keywordtype">void</span> on_sample_rejected(DataReader arg0, SampleRejectedStatus arg1) {</div>
<div class="line">        <span class="comment">// TODO 自动生成的方法存根</span></div>
<div class="line"></div>
<div class="line">    }</div>
<div class="line"></div>
<div class="line">    @Override</div>
<div class="line">    <span class="keyword">public</span> <span class="keywordtype">void</span> on_subscription_matched(DataReader arg0, SubscriptionMatchedStatus arg1) {</div>
<div class="line">        <span class="comment">// TODO 自动生成的方法存根</span></div>
<div class="line"></div>
<div class="line">    }</div>
<div class="line"></div>
<div class="line">    <span class="keyword">public</span> <span class="keywordtype">void</span> on_data_arrived(DataReader arg0, Object arg1, SampleInfo arg2) {</div>
<div class="line">        <span class="comment">// TODO 自动生成的方法存根</span></div>
<div class="line">    }</div>
<div class="line"></div>
<div class="line">    <span class="keyword">private</span> <span class="keywordtype">int</span>[] toIntArray(byte[] b, <span class="keywordtype">int</span> byte_arr_size) {</div>
<div class="line">        <span class="keywordtype">int</span> arr_len = byte_arr_size / 4;</div>
<div class="line">        <span class="keywordtype">int</span>[] arr = <span class="keyword">new</span> <span class="keywordtype">int</span>[arr_len];</div>
<div class="line">        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; arr_len; i++) {</div>
<div class="line">            <span class="keywordflow">if</span> (isLittleEndian()) {</div>
<div class="line">                arr[i] = (0xff &amp; b[i * 4 + 0]) | (0xff00 &amp; (b[i * 4 + 1] &lt;&lt; 8))</div>
<div class="line">                        | (0xff0000 &amp; (b[i * 4 + 2] &lt;&lt; 16)) | (0xff000000 &amp; (b[i * 4 + 3] &lt;&lt; 24));</div>
<div class="line">            } <span class="keywordflow">else</span> {</div>
<div class="line">                arr[i] = (0xff &amp; b[i * 4 + 3]) | (0xff00 &amp; (b[i * 4 + 2] &lt;&lt; 8))</div>
<div class="line">                        | (0xff0000 &amp; (b[i * 4 + 1] &lt;&lt; 16)) | (0xff000000 &amp; (b[i * 4] &lt;&lt; 24));</div>
<div class="line">            }</div>
<div class="line">        }</div>
<div class="line">        <span class="keywordflow">return</span> arr;</div>
<div class="line">    }</div>
<div class="line"></div>
<div class="line">    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keywordtype">boolean</span> isLittleEndian() {</div>
<div class="line">        <span class="keywordflow">return</span> ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN;</div>
<div class="line">    }</div>
<div class="line"></div>
<div class="line">}</div>
</div><!-- fragment --> </div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.10-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">
      <a href="http://www.zrtechnology.com">&copy; Copyright (c) 2018 ZhenRong Technology, Inc. All rights reserved.</a>
    </li>
  </ul>
</div>
</body>
</html>
